import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

/** tailwindcss */
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";

import UnoCSS from "unocss/vite";

import { createSvgIconsPlugin } from "vite-plugin-svg-icons";

import { vitePluginForArco } from "@arco-plugins/vite-vue";
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    UnoCSS(),
    createSvgIconsPlugin({
      iconDirs: [resolve(process.cwd(), "src/assets/svgs")], //svg地址
      symbolId: "icon-[dir]-[name]",
    }),
    vitePluginForArco({
      style: "css",
    }),
  ],
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import '@/assets/styles/variable.scss';`,
      },
    },
    postcss: {
      plugins: [tailwindcss, autoprefixer],
    },
  },
});
